<?php

namespace App\Repository\Repositories;

use App\Repository\Repositories\Interfaces\UserLogRepository;
use App\Repository\Models\UserLog;

/**
 * Class UserLognLogRepositoryEloquent.
 *
 * @package namespace App\Repository\Repositories;
 */
class UserLogRepositoryEloquent extends BaseRepository implements UserLogRepository
{
    /**
     * 搜索
     * @var array
     */
    protected $fieldSearchable = [
    ];

    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return UserLog::class;
    }
    
    public function getLastLogin($user_id){
        $data = $this->query()->where('user_id',$user_id)->limit(2)->orderBy('id', 'desc')->select('created_at')->get();
        $data = $data ? $data->toArray():null;
       
        return $data;
    }
}
